<?php

use Dingo\Api\Routing\Router;
use \App\Commons\Utils\RouterActionPrefixTools;
use App\Application\Controller\App\ProjectController;

/** @var Router $api */
$api = app(Router::class);

$api->group(['prefix' => 'app'], function (Router $api) {//模块前缀
    
    $api->group(['prefix' => 'project'], function (Router $api) {//控制器前缀,每个控制器一个
        $rapt = new RouterActionPrefixTools(ProjectController::class);
        
        /** @see ProjectController::index() */
        $api->post('index', $rapt->getAction('index'))->name('应用项目列表');
        
        /** @see ProjectController::store() */
        $api->post('/', $rapt->getAction('store'))->name('应用项目新增');
        
        /** @see ProjectController::getAuthLoginPageUrl() */
        $api->get('/{id}/get-auth-login-page-url', $rapt->getAction('getAuthLoginPageUrl'))->where('id', '[0-9]+')->name('应用项目授权地址');
        
        /** @see ProjectController::codeCommit() */
        $api->post('/{id}/code-commit', $rapt->getAction('codeCommit'))->where('id', '[0-9]+')->name('应用项目代码提交');
        
        /** @see ProjectController::miniProgramSubmitAudit() */
        $api->post('/{id}/mini-program-submit-audit', $rapt->getAction('miniProgramSubmitAudit'))->where('id', '[0-9]+')->name('应用项目提交审核');
       
        /** @see ProjectController::miniProgramRelease() */
        $api->post('/{id}/mini-program-release', $rapt->getAction('miniProgramRelease'))->where('id', '[0-9]+')->name('应用项目发布已通过审核的小程序');
       
        /** @see ProjectController::update() */
        $api->put('/{id}', $rapt->getAction('update'))->where('id', '[0-9]+')->name('应用项目更新');
        
        /** @see ProjectController::show() */
        $api->get('/{id}', $rapt->getAction('show'))->where('id', '[0-9]+')->name('应用项目详情');
        
        /** @see ProjectController::publishMiniProgram() */
        $api->get('/{id}/publish-mini-program', $rapt->getAction('publishMiniProgram'))->where('id', '[0-9]+')->name('应用项目发布小程序');
        
        /** @see ProjectController::getExperienceQrCode()  */
        $api->get('/{id}/get-experience-qr-code', $rapt->getAction('getExperienceQrCode'))->where('id', '[0-9]+')->name('获取体验版二维码');
    });
});